SHELL = /bin/bash
DIRS = utils test
DESTDIR = /usr
includedir = /include
libdir = /lib
projdir = /icecode
MAKEFLAGS = DESTDIR=$(DESTDIR)

.PHONY: install uninstall clean

all:
	for d in $(DIRS); do $(MAKE) $(MAKEFLAGS) -C $$d all; done

clean:
	for d in $(DIRS); do $(MAKE) $(MAKEFLAGS) -C $$d clean; done

install:
	install -m 755 -d $(DESTDIR)$(includedir)$(projdir)
	install -m 444 icecode.hpp $(DESTDIR)$(includedir)$(projdir)/

	for d in $(DIRS); do $(MAKE) $(MAKEFLAGS) -C $$d install; done

uninstall:
	$(RM) $(DESTDIR)$(includedir)$(projdir)$(projdir).hpp
	for d in $(DIRS); do $(MAKE) $(MAKEFLAGS) -C $$d uninstall; done
